using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using IronSvn;

namespace IronSvn
{
   public class Example : ExampleBase
   {
      public override SvnResult RunTest(string repo, string local)
      {
         SvnResult result;
         using (SvnClient client = new SvnClient())
         {
            // Delete a repsitory if it exists
            client.DeleteRepository(repo);

            // Create a blank repository
            client.CreateRepository(repo);

            // For security:
            //client.UserName = "user";
            //client.Password = "password";

            // Create a workspace
            result = client.Checkout(repo, local);

            // Even though there are no external updates, go ahead and do an update
            result = client.Update(local);

            // Create a random file in the workspace
            string file = Path.Combine(local, "test.txt");
            File.WriteAllText(file, "test data");

            // Add the file in the workspace
            result = client.Add(file);

            // Commit the workspace
            result = client.Commit(local, "Message");

            Finish(client, repo, local);
         }
         return result;
      }
   }
}
